<template>
    <div class="my-check-box" @click="$emit('change',!value)">
        <div class="my-check-box__body" :class="{active: value}">
        </div>

        <div class="my-check-box__text">
            <slot></slot>
        </div>
    </div>
</template>


<script>
export default{
    name:"MyCheckbox",
    props: {
        value: {
            type: Boolean,
            default: false
        }
    },
    model:{
        event: "change",
        prop: "value"
    }
}

</script>

<style lang="scss" scoped>
.my-check-box{
    display: inline-flex;
    justify-content: center;
    align-items: center;
    height: 38px;
    cursor: pointer;

    // &在scss里面相当于占位符，此处相当于my-check-box
    &__body{
        width: 38px;
        height: 100%;
        background: url(../assets/img/checkbox.png) no-repeat;
        background-size: 100% auto;
        background-position: 0 -184px;

        &.active{
        background-position: 0 -232px;
        }

    }

    &__text{
        font-size: 30px;
        margin-left: 20px;
        color: #2D2D2D;
    }
}

</style>


